1. Technology Field
The present invention relates to a data writing method for a rewritable non-volatile memory module, and a memory controller and a memory storage apparatus using the method.
2. Description of Related Art
Digital cameras, cells phones, and digital music players have undergone rapid growth in recent years, so that consumer demand for storage media have also rapid increased. Since a rewritable non-volatile memory has the characteristics of non-volatility of data, low power consumption, small volume, non-mechanical structure, and fast reading and writing speed, the rewritable non-volatile memory is the most adaptable memory to be applied in a portable electronic product, such as a notebook computer. A solid state drive is a storage apparatus adopting flash memory as storage medium. Therefore, the flash memory industry has become a very important part of the electronic industry in recent years.
A flash memory module has a plurality of physical blocks, and each of the physical blocks has a plurality of physical pages, wherein data must be written into a physical block according to the sequence of the physical pages in the physical block. In addition, a physical page containing data has to be erased before it is used for writing new data. Particularly, each physical block is the smallest erasing unit, and each physical page is the smallest programming (i.e., writing) unit. Therefore, in the management of the flash memory module, the physical blocks are grouped into a data area and a spare area.
The physical blocks of the data area are used for storing data stored by the host system. To be more specific, a memory management circuit in a memory storage apparatus converts a logical access address accessed by the host system into a logical page of a logical block and maps the logical page of the logical block to a physical page of a physical block in the data area. Namely, in the management of a flash memory module, the physical blocks in the data area are deemed used physical blocks (for instance, the physical blocks already containing data written by a host system). For example, the memory management circuit records the mapping relationship between the logical blocks and the physical blocks in the data area in a logical block-physical block mapping table, wherein the logical pages of each logical block are sequentially mapped to the physical pages of the corresponding physical block.
Physical blocks in the spare area are used for substituting the physical blocks in the data area. In particular, a physical block already containing data has to be erased before it is used for writing new data, while a physical block in the spare area is used for writing updated data in replacement of the physical block originally mapped to a logical block. Hence, the physical blocks in the spare area are either blank blocks or usable blocks (i.e., these blocks do not contain data, or these blocks contain data marked as invalid data).
Namely, the physical pages of the physical blocks in the data area and the spare area alternately map the logical pages of the logical blocks for storing data written by the host system. For example, the memory manage circuit of the memory storage apparatus selects at least a physical block from the spare area as a global random physical block, and when the logical access address, that the updated data to be written by the host system belongs to, corresponds to a logical page of a logical unit in the storage apparatus, the memory management circuit in the storage apparatus writes the updated data into the physical pages of the global random physical blocks.
Moreover, when the updated data is written into the global random physical blocks, the memory management circuit may record updated information about the updated logical page in the global random area searching table. Namely, the global random area searching table records information about the physical pages of the global random physical blocks, which are used for writing the updated data of the updated logical pages. Here, a record for storing updated information of an updated logical page in the global random area searching table is called an entry. Every entry includes the field for recording the address of the updated logical page, the field for recording the address of the physical page storing the data belonging to the updated logical page in the global random physical blocks and the field for marking whether the entry is valid or not. Because data belonging to all logical pages may be temporarily stored in the global random area, the field for recording the address of the updated logical page in the global random area searching table must include more bits, so as to store enough information for identifying all the addresses of the logical pages.
During the operation of the memory storage apparatus, the global random area searching table must be loaded into the buffer memory for accessing. However, for the memory storage apparatus equipped with the buffer memory having small storage capacity, the said global random area searching table can not be loaded into the buffer memory. Therefore, developing a data writing method, which can using the global random physical block to store data in a memory storage apparatus equipped with the buffer memory having small storage capacity, is needed.
Nothing herein should be construed as an admission of knowledge in the prior art of any portion of the present invention. Furthermore, citation or identification of any document in this application is not an admission that such document is available as prior art to the present invention, or that any reference forms a part of the common general knowledge in the art.